from app import app
from .etf_collector import ETFCollector
from .lof_collector import LOFCollector
from .money_collector import MoneyCollector

def collect_all():
    """采集所有类型基金数据"""
    with app.app_context():
        print("开始采集ETF基金数据...")
        etf_collector = ETFCollector()
        etf_result = etf_collector.collect_all()
        
        print("开始采集LOF基金数据...")
        lof_collector = LOFCollector()
        lof_result = lof_collector.collect_all()
        
        print("开始采集货币基金数据...")
        money_collector = MoneyCollector()
        money_result = money_collector.collect_all()
        
        return all([etf_result, lof_result, money_result])

if __name__ == '__main__':
    success = collect_all()
    print("采集完成" if success else "采集过程中存在错误")